import React, { 
    Component 
} from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';

import { actionUserInformationReview } from '../../actions';
import GraphicList from '../../components/GraphicList';

class Information extends Component{
    static propTypes = {
        informationList: PropTypes.array
    }

    componentDidMount() {
        // 调用Action方法获取数据
        this.props.fetchGetUserInfo('subreddit')
        // console.log(this.props,'props')        
        // console.log(this.props.loading.show,'loading')
    }

    render () {
        return (
            <div className="information_list">
                <GraphicList informationList={this.props.informationList}/>
            </div>
        )
    }
}

export default connect(
    // mapStateToProps 获取Reducer数据
    state => ({
        informationList: state.userInformationReviewReducer.informationList,
        loading: state.globalReducer.loading,
    }),
    // mapDispatchToProps 调用Action方法
    dispatch => bindActionCreators({
        fetchGetUserInfo: actionUserInformationReview.fetUserInforList
    },dispatch)
)(Information)